<?php
	include_once 'BaseView.php';

	class UserToolBarView extends BaseView {
		
		public function __construct() {
			$this->showHeader = $this->showUserToolbar = false;
		}
		
		public function render() {
			//echo '<script type="text/javascript" src="content/scripts/logout.js" />'; 
			echo '<div id="user-toolbar-wrapper"><div id="user-toolbar-inside">';
			if(!$this->data->loggedUserName) {//$data->loggedUser == null
				echo '<div class="right">';
				include('loginForm.php');
				echo '<div class="register"><a href="'.URI::getUrl('register').'">zarejestruj...</a></div>';
				echo '</div>';
			} else {
				?>
				<script type="text/javascript" src="content/scripts/logout.js"> </script>
				<div class="left">
					<div class="icon"><a href="<?php URI::theUrl() ?>"><img src="<?php URI::theUrl()?>/content/images/ico.png"></a></div>
					<div class="text"><p>witaj <a href="<?php URI::theUrl(null, $this->data->loggedUserName); ?>"><?php echo $this->data->loggedUserName; ?></a></p></div>
				</div>				
				<div class="right">
					<div class="edit-profile"><a href="<?php URI::theUrl('settings', $this->data->loggedUserName) ?>">edytuj profil...</a></div>
					<div><form><input type="button" class="button" value="Wyloguj" onclick="logout('<?php URI::theUrl('login', null, 'logout') ?>');"/></form></div>
				</div>		
				<?php
			}
			echo '</div></div><!-- user-toolbar-wrapper -->';
		}
	
	}
?>